import Guide from '@/components/Guide';
import { trim } from '@/utils/format';
import { PageContainer } from '@ant-design/pro-components';
import { useModel } from '@umijs/max';
import styles from './index.less';

// import { proto.nexus.proto.Device, Response } from '@/utils/nexus_pb.js';
import { NexusServiceClient } from '@/utils/nexus_grpc_web_pb.js';
import { Device, GetNetworkRequest } from '@/utils/nexus_pb';

var client = new NexusServiceClient('http://localhost:8080', null, null);

var request = new Device();
request.setName('World');
console.log(Device)

client.addDevice(request, {}, (err, response) => {
  console.log(response.getMsg());
});

var req = new GetNetworkRequest()
req.setName('net')

client.getNetwork(req, {}, (err, resp) => {
  console.log(resp)
})

const HomePage: React.FC = () => {
  const { name } = useModel('global');
  return (
    <PageContainer ghost>
      <div className={styles.container}>
        <Guide name={trim(name)} />
      </div>
    </PageContainer>
  );
};

export default HomePage;
